package threads;
import java.sql.SQLException;

import Exceptions.AcabouRegistrosException;

import persistence.ConexaoMysql;
import entidades.Nota;


public class ProcessaNFBlockingQueue extends Thread {
	
	private ConexaoMysql conn = new ConexaoMysql();
	private Nota nota;
	private int nroThread;

	public ProcessaNFBlockingQueue(Nota nota,int nroThread) {
		this.nroThread = nroThread;
		this.nota = nota;
	}
	 
	@Override
	public void run() {
		try {
			while(true){
				conn.conecta();
				try {					
					nota.atualizaBlockingQueue(conn,nroThread);
				} catch (AcabouRegistrosException e) {
					return;
				}
				conn.desconecta();
			}
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
